#ifndef USERINFOMODEL_H
#define USERINFOMODEL_H
#include <QAbstractListModel>
#include <QStringList>
#include "dataDefination.h"

class UserInfoModel:public QAbstractListModel
{
    Q_OBJECT
     public:
         enum UserInfoRoles {
             IpRole = Qt::UserRole + 1,
             NameRole
         };

         UserInfoModel(QObject *parent = 0);

         void addUserInfo(const userInfo &userinfo);
         void clear();
         void copyFromList(const QList<userInfo> &list);
         int rowCount(const QModelIndex & parent = QModelIndex()) const;
         QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;

         // lookup
         QString ipToName(QString ip);

     private:
         QList<userInfo> m_userInfos;
};

#endif // USERINFOMODEL_H
